package com.alks.common.utils.export.constants;

import lombok.Getter;

/**
 * @author: chen
 * @date: 2024/12/28
 * @description: 文件状态
 */
@Getter
public enum FileStatusEnum {

    PREPARING(0, "生成中"),
    READY(1, "已生成"),
    DOWNLOADED(2, "已下载"),
    ERROR(3, "生成失败"),
    FILE_EXPIRE(4, "已失效")
    ;

    final private Integer code;

    final private String value;

    FileStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static FileStatusEnum getByCode(Integer code) {
        for (FileStatusEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
